/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package services;

import Entitys.TipoFabricante;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

/**
 *
 * @author MAURO
 */
public class TipoFabricanteServices {
    
    EntityManagerFactory emf= Persistence.createEntityManagerFactory("DrugStoreProPU");
         EntityManager em=emf.createEntityManager();
         
         public void create (TipoFabricante f){
          em.getTransaction().begin();
          em.persist(f);
          em.getTransaction().commit();
          em.close();
         }
         
         public void delete (Integer p){
          em.getTransaction().begin();
          TipoFabricante p1=em.find(TipoFabricante.class, p);
          if(p1!= null)
          em.remove(p1);
          em.getTransaction().commit();
          em.close();
         }
         
        
         
    
}
